﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace B.Z.BasicData.API.Write
{
    public class MyExceptionFilter : IExceptionFilter
    {
        private readonly ILogger<MyExceptionFilter> logger;

        public MyExceptionFilter(ILogger<MyExceptionFilter> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError($"全局异常：【{context.Exception.Message}】");
        }
    }
}
